
// 继承
var User = require("./user")

// apply 改变this指向 写法不一样 call(this,[a1,a2])  call(this,argument) 
// call  apply(this,ai,a2)
// bind
function Student(name, age, word, grade) {


    User.apply(this, [name, age, word])

    this.grade = grade

    this.init = function () {
        console.log("初始化");
    }

}
// 原型链继承
// 实例化继承
// Student.prototype = new User()
// 对象复制继承
// for in 继承对象遍历
for (var i in User.prototype) {
    Student.prototype[i] = User.prototype[i]
}

// 方法重载
Student.prototype.say = function () {
    return this.name + " 快乐的说: 我考试得了 " + this.grade
}

// 静态对象
Student.hobby = ["写代码", "熬夜", "背面试题"]


module.exports = Student